<%@page import="com.jsz.peini.common.util.PeiniUtils"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>陪你</title>
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport" id="viewport" />
	
	<meta content="telephone=no" name="format-detection" />
	<link rel="stylesheet" href=" dist/css/swiper.min.css">
	<link rel="stylesheet" type="text/css" href="css/index.css">
	<link rel="stylesheet" type="text/css" href="css/task-delat.css">
	<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=qk5fYMC17KUfmYBTV1TzTjbeAG3W5iKq"></script>
	<script  type="text/javascript">
     	$(function() {
     		$(".atar_Show div").each(function(index, element) {
		        var num=$(this).attr("tip");
		        var www=num*2*14;//
		        $(this).css("width",www);
		    });
     	});
     	
     	$(document).ready(function (){
     		$(".act-details img").addClass('det-tu');
    		getLocation();
    	});
    	
    	function getLocation(){
    		var map = new BMap.Map("allmap");
    		var geolocation = new BMap.Geolocation();
    		geolocation.getCurrentPosition(function(r){
    			/* if(this.getStatus() == BMAP_STATUS_SUCCESS){
    		        var geoc = new BMap.Geocoder(); 
    				geoc.getLocation(r.point, function(rs){
    					var addComp = rs.addressComponents;
    					var address = addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber;
    					alert(address);
    				}); 
    			}else {
    				alert('failed'+this.getStatus());
    			}  */
    			var pointA = r.point;
    			var pointB = new BMap.Point(${info.ypoint},${info.xpoint});
    			//alert(((map.getDistance(pointA,pointB))/1000).toFixed(2)+' 米。');
    			var str = ((map.getDistance(pointA,pointB))/1000).toFixed(1)+'km';
    			//alert(str);
    			$(".dist").html(str);
    		},{enableHighAccuracy: true})
    	}
    </script>

  </head>
  
  <body>
    <section class="banner">
		<div class="banner-div ">
			<div class="swiper-container">
		        <div class="swiper-wrapper">
		        	<c:forEach items="${fn:split(seller.sellerImg,',') }" var="adv">
		        		<div class="swiper-slide"><img src="<%=PeiniUtils.IMGHOST %>${adv }"></div>
		        	</c:forEach>
		        </div>
		        <!-- Add Pagination -->
		        <div class="swiper-pagination"></div>
		  	</div>
		</div>
		<div class="infor-div">
			<div class="titl">
				<img src="<%=PeiniUtils.IMGHOST %>${info.imageHead }" alt="">
				<div class="name"><span>${info.nickName } </span>
				<c:choose>
					<c:when test="${info.sex == 1 }">
						<i class="sex-m">${info.age }</i>
					</c:when>
					<c:when test="${info.sex == 2 }">
						<i class="sex-w">${info.age }</i>
					</c:when>
				</c:choose>
				<div class="hat">
					<c:if test="${info.goldList != null && info.goldList != 0 }">
						<span class="hataa"></span>
					</c:if>
					<c:if test="${info.buyList != null && info.buyList != 0 }">
						<span class="hatbb"></span>
					</c:if>
					<c:if test="${info.integrityList != null && info.integrityList != 0 }">
						<span class="hatcc"></span>
					</c:if>
				</div></div>  
				<div class="credit">信用度：${info.reputation }</div>
			</div>
			<div class="pay">
				<c:choose>
					<c:when test="${info.otherBuy == 1 }">
						发起人买单
					</c:when>
					<c:when test="${info.otherBuy == 2 }">
						接收人买单
					</c:when>
					<c:when test="${info.otherBuy == 3 }">
						AA制买单
					</c:when>
				</c:choose>
			</div>
			<div class="dist"></div>
		</div>
	</section>
	<section class="buy-act">
		<div>
			<ul>
				<c:forEach items="${info.userLabel }" var="label">
					<li>${label['label_name'] }</li>
				</c:forEach>
			</ul>
			<ul>
				<li><span>目的·</span>${target }</li>
				<li><span>地点·</span>${seller.sellerName } <!-- <em class="ad"></em> --></li>
				<li><span>时间·</span><fmt:formatDate value="${info.taskAppointedTime }" pattern="yyyy-MM-dd HH:mm" /></li>
				<li><span>希望·</span>
					<c:if test="${info.otherLowAge != null && info.otherLowAge !=0 && info.otherHignAge != null && info.otherHignAge != 0 }">
						${info.otherLowAge }-${info.otherHignAge }
					</c:if>
					<c:choose>
						<c:when test="${info.otherSex == 1  }">
							帅哥
						</c:when>
						<c:when test="${info.otherSex == 2  }">
							妹子
						</c:when>
					</c:choose>
					<c:choose>
						<c:when test="${info.otherGo == 1  }">
							我接Ta
						</c:when>
						<c:when test="${info.otherGo == 2  }">
							Ta接我
						</c:when>
						<c:when test="${info.otherGo == 3  }">
							自由行
						</c:when>
					</c:choose>
				</li>
			</ul>
		</div>
	</section>
	 <section class="act-details">
	 	<div >
	 		${info.taskDesc }
	 	</div>
	 </section>
	<section class="down">
	 	<div>
	 		<span>时光因你而不同</span>
	 		<!-- <input type="button" value="立即下载" onclick="download()"> -->
	 		<button onclick="download()">立即下载</button>
	 	</div>
	 </section>
 <script src=" dist/js/swiper.min.js"></script>

    <!-- Initialize Swiper -->
    <script>
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        paginationClickable: true,
        spaceBetween: 30,
        centeredSlides: true,
        autoplay: 2500,
        autoplayDisableOnInteraction: false,
        slidesPerView: 1,
        loop: true
    });
    </script>
	
	<script type="text/javascript">
		function download(){
			var u = navigator.userAgent;
		    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
		    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
		    if(isAndroid == true){
		    	//alert("安卓");
		    	location.href="<%=PeiniUtils.ANDROIDURL%>";
		    }else{
		    	location.href="<%=PeiniUtils.IOSURL%>";
		    }
		    /* alert('是否是Android：'+isAndroid);
		    alert('是否是iOS：'+isiOS); */
		}
	</script>
  </body>
</html>
